﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.Data.SqlClient;
using websoniBO;

namespace websoni.Adminpages
{
    public partial class WebForm6 : System.Web.UI.Page
    {
        Comments c = new Comments();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = c.GetRecords(-99, "", "", false, " and ");
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }

        }

        protected void Button1_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                DataTable dt = c.GetRecords(Convert.ToInt64(e.CommandArgument), "", "", false, " and ");
                c.cid = Convert.ToInt64(dt.Rows[0]["cid"].ToString());
                c.sender_name = dt.Rows[0]["sender_name"].ToString();
                c.comment = dt.Rows[0]["comment"].ToString();
                c.isdeleted = true;
                c.SaveRecords();
                Response.Redirect("~/Adminpages/AComment.aspx");
            }
        }

        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {

        }

        protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {

        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            DataTable dt1 = c.GetRecords(-99, "", "", false, " and ");
            GridView1.DataSource = dt1;
            GridView1.DataBind();
        }

        
    }
}
